// Function 类型表示函数，任何函数都属于这个类型
function doSomething(f: Function) {
  return f(1, 2, 3)
}

const repeatFn = (str: string, times: number): string => {
  return str.repeat(times)
}

function greet(fn: (a: string) => void): void {
  return fn('world')
}

type Person = {
  name: string
}

const people = ['alice', 'bob', 'coda'].map((name: string): Person => ({ name }))

console.log(people)
